package com.wuxiaoge.controller;

import com.wuxiaoge.entity.User;
import com.wuxiaoge.result.Result;
import com.wuxiaoge.service.UserService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;



@Validated
@RestController
@RequiredArgsConstructor
public class UserController {

    private final UserService userService;

    @PostMapping("/save")
    public Result<User> save(@RequestBody @Valid User user){
        return Result.ok(userService.save(user));
    }

}
